<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" charset="utf-8">
        //全局变量
        var a = 3;
        function test() {
            //局部变量
            var a = 2;
            alert(a);
        }
        test();
    </script>
</head>
<body>
</body>
</html>